package com.itheima.tlias.filter;

import jakarta.servlet.*;

import java.io.IOException;

//@WebFilter(urlPatterns = "/*")
public class FilterDemo2 implements Filter {
	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		Filter.super.init(filterConfig);
		System.out.println("开始拦截");
	}

	@Override
	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
		System.out.println("2）拦截前....");
		filterChain.doFilter(servletRequest, servletResponse);
		System.out.println("3）拦截后....");
	}

	@Override
	public void destroy() {
		Filter.super.destroy();
		System.out.println("销毁拦截");
	}
}
